package com.saint.farmshop.Controller;

import com.saint.farmshop.Dto.OrderDto;
import com.saint.farmshop.Entity.Order;
import com.saint.farmshop.Mapper.MapperImpl.OrderMapperImpl;
import com.saint.farmshop.Mapper.MapperImpl.ProductionMapperImpl;
import com.saint.farmshop.Mapper.MapperImpl.UserMapperImpl;
import com.saint.farmshop.Service.ServiceImpl.OrderServiceImpl;
import com.saint.farmshop.Utils.Result;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 订单控制器
 *
 * @author Saint
 * @date 2022/06/30
 */
@RestController
public class OrderController {

    @Resource
    OrderServiceImpl orderService;

    @RequestMapping("/createOrder")
    OrderDto createOrder(@RequestBody Order order){
        return orderService.createOrder(order);
    }

    @RequestMapping("/getOrderList")
    List<OrderDto> getOrderList(@RequestParam String openId){
        return orderService.getOrderList(openId);
    }
}
